package com.itcast.fjs.controller;

import com.itcast.fjs.pojo.User;
import com.itcast.fjs.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("user")
public class UserController {
    @Value("${server.port}")
    int port;
    @Autowired
    UserService userService;
    @GetMapping("{id}")
    public String findById(@PathVariable Integer id){

        User userById = userService.findUserById(id);
        String name = userById.getName();
        return name+"当前端口"+port;
    }
}